<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        *{
            padding: 0;
            margin: 0;
        }
        body{
            width: 500px;
            height: 500px;
            background: black;
            display: flex;
            justify-content: center;
            align-items: center;
        }
        main{
            width: 400px;
            height: 400px;
            border: solid 1px white;
            
        }
        div{
            width: 100px;
            height: 100px;
            background-color: red ;
            /* 不同动画也能组合使用 */
            animation-name: hd,hd1;
            animation-duration: 2s,1s;
            /* 设置动画走完后停下不回复到原位 */
            animation-fill-mode: forwards;
        }
        /* 创建关键帧动画 */
        @keyframes hd {
            25%{
                transform: translateX(300px);
            }
            50%{
                transform: translate(300px,300px);
            }
            100%{
                transform: translateY(300px);
            }
        }
        @keyframes hd1 {
            25%{
                background-color: yellow ;
            }
            50%{
                background-color: blue ;
            }
            75%{
                background-color: green ;
            }
        }
    </style>
</head>
<body>
    <main>
        <div></div>
    </main>
</body>
</html>